package cn.wolfcode.luowowo.hotel.service.impl;

import cn.wolfcode.luowowo.hotel.domain.HotelRoomType;
import cn.wolfcode.luowowo.hotel.mapper.HotelRoomTypeMapper;
import cn.wolfcode.luowowo.hotel.query.HotelRoomTypeQueryObject;
import cn.wolfcode.luowowo.hotel.service.IHotelRoomTypeService;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 酒店主题
 *
 * @author win
 */
@Service
public class HotelRoomTypeServiceImpl implements IHotelRoomTypeService {

    @Autowired
    private HotelRoomTypeMapper hotelThemeCityMapper;

    @Override
    public void deleteById(Long id) {
        hotelThemeCityMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void saveOrUpdate(HotelRoomType theme) {
        if (theme == null) {
            return;
        }
        if (theme.getId() == null) {
            hotelThemeCityMapper.insert(theme);
        } else {
            hotelThemeCityMapper.updateByPrimaryKey(theme);
        }
        // TODO 后续维护关系
    }

    @Override
    public List<HotelRoomType> findById(Long id) {
        return hotelThemeCityMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<HotelRoomType> selectAll() {
        return hotelThemeCityMapper.selectAll();
    }

    @Override
    public PageInfo<HotelRoomType> query(HotelRoomTypeQueryObject qo) {
        return null;
    }
}
